<div class="ribbon">
    <a href=""><span class="home fa fa-home"></span></a>
    <ol class="breadcrumb">
        <li>订单列表</li>
    </ol>
</div>

<div class="table-wrapper">

    <div class="toolbar">
        <form role="form">
            <div class="row">
                    <div class="col-md-8">
                        <label class="input">订单状态：</label>
                        <label class="input"><select  ng-model="q.orderStatus" ng-options="orderStatus.value for orderStatus in vm.orderStatus" class="form-control" ng-selected="" ng-change="orderStatusSearchChange()"></select></label>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <label class="input">订单来源：</label>
                        <label class="input"><select  ng-model="q.accessType" ng-options="accessType.value for accessType in vm.accessType" class="form-control" ng-selected="" ng-change="accessTypeSearchChange()"></select></label>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <label class="input">订单编号：</label>
                        <label class="input"><input type="text"  class="form-control" ng-model="q.orderSn"></label>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <label class="input">支付状态：</label>
                        <label class="input"><select  ng-model="q.payStatus" ng-options="payStatus.value for payStatus in vm.payStatus" class="form-control" ng-selected="" ng-change="payStatusSearchChange()"></select></label>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                        <p></p>
                        <label class="input">用户评价：</label>
                        <label class="input"><select  ng-model="q.orderServiceQuality" ng-options="orderServiceQuality.value for orderServiceQuality in vm.orderServiceQuality" class="form-control" ng-selected="" ng-change="orderServiceQualitySearchChange()"></select></label>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <label class="input">支付方式：</label>
                        <label class="input"><select  ng-model="q.payType" ng-options="payType.value for payType in vm.payType" class="form-control" ng-selected="" ng-change="payTypeSearchChange()"></select></label>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                        <label class="input">订单客户：</label>
                        <label class="input"><input type="text"  class="form-control" ng-model="q.userId"></label>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <label class="input">结算方式：</label>
                        <label class="input"><select  ng-model="q.orderTriggerType" ng-options="orderTriggerType.value for orderTriggerType in vm.orderTypesConfig" class="form-control" ng-selected="" ng-change="orderTrigerTypeSearchChange()"></select></label>

                    </div>
                    <div class="col-md-4">
                        <label class="input">时间范围：</label>
                        <label class="input"><input type="text"  id="datetimepickerStart"  class="form-control" ng-model="q.startTime"></label>
                        <label class="input">—</label>
                        <label class="input"><input type="text"  id="datetimepickerEnd"  class="form-control" ng-model="q.endTime"></label>
                        <button title="删除时间" ng-click="deleteTimeRange()" type="button" class="btn btn-primary btn-outline btn-xs">
                            <i class="fa fa-trash-o"></i>
                        </button>
                        <button  ng-click="search()" class="btn btn-md btn-primary pull-right"><i class="fa fa-search"></i> 搜索 </button>

                        <label class="input">配送人员：</label>
                        <label class="input"><input type="text"  class="form-control" ng-model="q.dispatcherId"></label>
                    </div>
                </div>

            </div>
            <!--<div class="row" style="margin-top: 10px">-->
            <!--<div class="inline-group col-md-12">-->
            <!--<label class="input">订单号：</label>-->
            <!--<label class="input"><input type="text" class="form-control input-sm" ng-model="q.orderSn" ng-change="search()" placeholder="订单号"> </label>-->

            <!--<label class="input">客户编号：</label>-->
            <!--<label class="input"><input type="text" class="form-control input-sm" ng-model="q.userId" ng-change="search()" placeholder="客户编号"> </label>-->

            <!--<label class="input">呼入电话：</label>-->
            <!--<label class="input"><input type="text" class="form-control input-sm" ng-model="q.callInPhone" ng-change="search()" placeholder="呼入电话"> </label>-->

            <!--<button type="submit" class="btn btn-md btn-primary pull-right" ng-click="search()"><i class="fa fa-search"></i> 搜索 </button>-->
            <!--</div>-->
            <!--</div>-->
        </form>
    </div>
    <table class="table table-striped table-hover props table-sm">
        <thead>
        <tr>
            <th width="1%"></th>
            <th width="3%">序号</th>
            <th width="3%">类型</th>
            <th width="5%">订单编号</th>
            <th width="4%">订单状态</th>
            <th width="4%">接入方式</th>
            <th width="4%">支付方式</th>
            <th width="5%">订单客户</th>
            <th width="15%">收货地址</th>
            <th width="8%">收货人</th>
            <th width="4%">配送员</th>
            <th width="5%">所属门店</th>
            <th width="4%">金额(元)</th>
            <th width="4%">优惠券</th>
            <th width="4%">支付状态</th>
            <th width="4%">用户评价</th>
            <th width="5%">配送时长</th>
            <th width="9%">创建时间</th>
            <!--<th width="9%">预约时间</th>-->
            <th width="3%">发票</th>
            <th width="10%">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="order in vm.orderList" ng-class="{danger:order.timeSpan>10&&order.orderStatus==0}">
            <td></td>
            <td class="message">{{$index+1+pager.pageSize*(pager.getCurPageNo()-1)}}</td>
            <td ng-if="order.orderTriggerType.index==1">
                <div style="width:40px;height:40px;background-color:#F0F; border-radius: 50%;color:#FFF;text-align:center;line-height:40px;:middle;font-size: large">斤
                </div>
            </td>
            </td>
            <td ng-if="order.orderTriggerType.index!=1" >
                <div style="width:40px;height:40px;background-color:#00F; border-radius: 50%;color:#FFF;text-align:center;line-height:40px;:middle;font-size: large">瓶
                </div>
            </td>
            <td class="message">{{order.orderSn}}</td>
            <td class="message">{{vm.orderStatusDisplay[order.orderStatus]}}</td>
            <td class="message">{{order.accessType.name}}</td>
            <td class="message">{{order.payType.name}}</td>
            <td class="message">{{order.customer.userId}}</td>


            <td class="message">{{order.recvAddr.province}}{{order.recvAddr.city}}{{order.recvAddr.county}}{{order.recvAddr.detail}}</td>
            <td class="message" title="电话：{{order.recvPhone}}">{{order.recvName}}</td>

            <td class="message" title="姓名：{{order.dispatcher.name}} 电话：{{order.dispatcher.mobilePhone}} 工号：{{order.dispatcher.jobNumber}}">{{order.dispatcher.userId}}</td>

            <td class="message">{{order.dispatcher.department.name}}</td>
            <td class="message">{{getFixData(order.orderAmount)}}</td>
            <td class="message">{{order.couponCount}}张</td>
            <td class="message">{{order.payStatus.name}}</td>
            <td class="message">{{order.orderServiceQuality.name}}</td>
            <td class="message">{{order.deliveryTime}}</td>
            <td class="message" title="预约时间：{{order.reserveTime}}">{{order.createTime}}</td>
            <!--<td class="message">{{order.reserveTime}}</td>-->
            <td class="message"><input type="checkbox" ng-checked="order.invoiceStatus.index==1" ng-model="order.invoiceStatusFlag" ng-click="invoiceStatusChanged(order)"/></td>
            <td class="operate">
                <button title="详情" ng-click="viewDetails(order)" type="button" class="btn btn-primary btn-outline btn-xs">
                    <i class="">详情</i>
                </button>
                <!--<button title="修改" ng-click="modify(order)" type="button" class="btn btn-primary btn-outline btn-xs">-->
                <!--<i class="fa fa-edit"></i>-->
                <!--</button>-->
                <button title="指派" ng-if="order.taskId" ng-click="assign(order)" type="button" class="btn btn-primary btn-outline btn-xs">
                    <i class="">指派</i>
                </button>
                <button title="作废" ng-if="order.orderStatus!=3&&order.orderStatus!=4" ng-click="delete(order)" type="button" class="btn btn-primary btn-outline btn-xs">
                    <i class="">作废</i>
                </button>
            </td>
        </tr>
        </tbody>
    </table>
    <div ng-if="vm.orderList.length == 0" nj-table-no-data></div>
    <div nj-pager pager="pager"></div>
</div>
